//
//  LGTLodingView.swift
//  KJLGT
//
//  Created by jenkin on 2019/9/19.
//  Copyright © 2019年 jenkin. All rights reserved.
//

import UIKit

class LGTLodingView: UIView {

    private var gifView:LGTGifView?
    override init(frame: CGRect) {
        super.init(frame: frame)
        self.backgroundColor = UIColor.white
//        self.gifView = LGTGifView()
//        self.addSubview(self.gifView!)
//        self.gifView?.showGIFImageWithLocalName(name: "loadding", completionClosure: {
//
//        })
//        self.gifView?.snp.makeConstraints({ (make) in
//            make.width.height.equalTo(KGif_Height)
//            make.center.equalToSuperview()
//        })
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    func showLoading(){
        self.isHidden = false
        self.gifView?.dissMissAnimation()
        self.gifView = LGTGifView()
        self.addSubview(self.gifView!)
        self.gifView?.showGIFImageWithLocalName(name: "loadding", completionClosure: {
            
        })
        self.gifView?.snp.makeConstraints({ (make) in
            make.width.height.equalTo(KGif_Height)
            make.center.equalToSuperview()
        })
    }
    
    func closeLoading(){
        self.isHidden = true
        if self.gifView != nil{
            self.gifView?.removeFromSuperview()
            self.gifView = nil
        }
    }
}
